package com.example.demo.Controller;

import com.example.demo.Entity.Record;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.example.demo.Dao.RecordRepository;
import com.example.demo.Entity.Record;

import javax.print.DocFlavor;
import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("Record")
public class RecordContorller {

    @Autowired
    private RecordRepository recordRepository;

    @RequestMapping("/getAllRecord")
    @ResponseBody
    public List<Record> findAllRecord(){
        List<Record> list = new ArrayList<Record>();
        list = recordRepository.findAll();
        return list;
    }

    @RequestMapping("/getBylocate")
    @ResponseBody
    public Record getByOpenId (String openid){
        Record user = recordRepository.findByOpenId(openid);
        return user;
    }


}